var alertDaliag = alertDaliag || {};
alertDaliag.alertFormSubmitSuceess = function (url, isParentUrl, msg) {
    Uz_layerMsg("white", 0);
    var html = $("<div id=\"J_sucess\"><img src=\"/Public/kanghui/images/sue.jpg\" \/><span class=\"J_sueText\"></span></div>")
    var height = $(window).height();
    var width = $(window).width();
    $("body").append(html);
    $("#J_sucess").show().css({ left: (width - 264) / 2 + "px", top: (height - 85) / 2 + $(window).scrollTop() + "px" });
    $(".J_sueText").text(msg);
    setTimeout(function () { $("#J_sucess").hide(); closeAlert(); }, 2000);
    setTimeout(function () {
        if (isParentUrl)
            parent.location.href = url;
        else
            location.href = url; 
    }, 2100);
}

alertDaliag.alertMsg = function (msg, script) {//文字
    Uz_layerMsg("black", 0.3);
    if (script == undefined)
        script = "";
    while (true) {
        if (script.indexOf("\"") >= 0) {
            script = script.replace("\"", "'");
        } else {
            break;
        }
    }
    var html = $("<div class=\"fn-alert J_alert\"><span class=\"J_alertText\">" + msg + "</span><p class=\"pp-25\"><a href=\"javascript:void(0)\" class=\"J-tisOk\" onclick=\"closeAlert();" + script + "\">确认</a></p></div>")
    var height = $(window).height();
    var width = $(window).width();
    $("body").append(html);
    $(".J_alert").show().css({ left: (width - 264) / 2 + "px", top: (height - 85) / 2 + $(window).scrollTop() + "px", zIndex: 9999 });
    //$(".J_alertText").text(msg);
}

function Uz_layerMsg(color, filter) {
    //创建遮罩层
    var width = $(window).width();
    var height0 = $(window).height();
    var height1 = $("body").height();
    height = height0 > height1 ? height0 : height1;
    var layer = $("<div id=\"JS-layerMsg\"></div>");
    $("body").append(layer);
    $("#JS-layerMsg").css({
        zIndex: "998",
        position: "absolute",
        top: "0px",
        left: "0px",
        height: height + "px",
        width: width + "px",
        backgroundColor: color,
        opacity: filter,
        filter: "alpha(opacity=" + filter + ")"
    });
}
function closeAlert() {
    $("#JS-layerMsg").remove();
    $(".J_alert").remove();
}

